package net.messagenet.mazor.exception;

/**
 * This Exception is thrown when an applicative error in the server has occurred
 * 
 * @author Idan
 *
 */

public class MZRApplicativeException extends Exception {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public Throwable detail;
	
	
	public MZRApplicativeException() {
	         initCause(null); 
	}

	public MZRApplicativeException(String s) {
		super(s);
		initCause(null); // Disallow subsequent initCause
	}

	public MZRApplicativeException(String s, Throwable cause) {
		super(s);
		initCause(null); // Disallow subsequent initCause
		detail = cause;
	}

	public String getMessage() {
		if (detail == null) {
				return super.getMessage();
		} else {
			return super.getMessage() + "; nested exception is: \n\t" +
			detail.toString();
		}
	}

	public Throwable getCause() {
		return detail;
	}

}
